const index = require('../config/index.js')
// 添加地址
export function addAddress(data) {
  return new Promise((resolve, reject) => {
    wx.request({
      url: index.api + 'address/add',
      method: 'POST',
      data,
      success(res) {
        resolve(res)
      },
      fail(res) {
        reject(res)
      }
    })
  })
}
// 获取地址
export function getAddress(id) {
  return new Promise((resolve, reject) => {
    wx.request({
      url: index.api + `address/${id}`,
      method: 'GET',
      success(res) {
        resolve(res)
      },
      fail(res) {
        reject(res)
      }
    })
  })
}

export default {
  addAddress,
  getAddress
}